package com.itheima.reggie.mapper;

import com.itheima.reggie.dto.SetmealDto;
import com.itheima.reggie.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SetmealDishMapper {

    /**
     * 添加套餐菜品集合
     * @param setmealDishes
     * @return
     */
    Integer addSetmealDish(List<SetmealDish> setmealDishes);

    /**
     * 修改套餐菜品：先执行批量删除，再执行批量添加
     * 根据套餐id，删除所有的菜品
     * @param
     * @return
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    Integer deleteSetmealDishes(Long setmealId);

    /**
     * 批量添加菜品
     * @param setmealDishList
     * @return
     */
    Integer addSetmealDishes(List<SetmealDish> setmealDishList);

    /**
     * 根据套餐id查找对应的菜品列表
     *
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> findSetmealDishBySetmealId(Long setmealId);

}
